package com.supermap.dataservice.cloud.agrinfo.crop;

import com.alibaba.dubbo.config.annotation.Service;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.cloud.agrinfo.crop.CropService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author aqua
 * @description
 * @date 2018年11月08 下午 4:46
 * @email 1301584033@qq.com
 */
@Service
public class CropServiceImpl implements CropService {

    @Resource
    private  CropMapper cropMapper;
    @Override
    public List<Map<String, Object>> getListCrop() {
        return cropMapper.getListCrop();
    }

    @Override
    public List<Map<String, Object>> getListCropChildNode(String codeId) {
        return cropMapper.getListCropChildNode(codeId);
    }

    @Override
    public JSONUtils getListCropByExpertId(Integer expertId) {
        List<Map<String , Object>> cropList = cropMapper.getListCropByExpertUserId(expertId);
        return new JSONUtils().setData(cropList).setCountSum(cropList == null ? 0 : cropList.size());
    }

    @Override
    public JSONUtils getSubjectByCrop(Integer crop) {
        return new JSONUtils().setData(cropMapper.getSubjectByCrop(crop));
    }
}
